import 'package:flutter/material.dart';
import 'btuuom_navigaton_bar_demo.dart';
import '../demo/listview_part.dart';
import '../demo/basic_demo.dart';
import '../demo/layout_demo.dart';
import '../demo/view_layout.dart';
import '../demo/sliver_demo.dart';
import '../demo/menu/main_menu_list.dart';

class ButtomNavigacitionWidge extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 6,
      child: Scaffold(
        backgroundColor: Colors.grey[100],
        appBar: AppBar(
          title: Text('HadesCool'),
          //title底部的阴影大小
          elevation: 10.0,
          bottom: TabBar(
            //未选中的背景
            unselectedLabelColor: Colors.black38,
            //指示器颜色
            indicatorColor: Colors.black54,
            //指示器长度：根据内容长度一致
            indicatorSize: TabBarIndicatorSize.label,
            indicatorWeight: 1.0,
            tabs: <Widget>[
              Tab(icon: Icon(Icons.local_florist)),
              Tab(icon: Icon(Icons.change_history)),
              Tab(icon: Icon(Icons.directions_bike)),
              Tab(icon: Icon(Icons.view_quilt)),
              Tab(icon: Icon(Icons.ac_unit)),
              Tab(icon: Icon(Icons.menu)),
            ],
          ),
        ),
        //TODO 每个tab显示的具体内容
        body: TabBarView(
          children: <Widget>[
            ListViewPart(),
            BasicDemo(),
            LayoutDemo(),
            ViewLayout(),
            SliverDemo(),
            MainMenuList(),
          ],
        ),
        drawer: Drawer(
          child: ListView(
            padding: EdgeInsets.zero,
            children: <Widget>[
              UserAccountsDrawerHeader(
                accountName: Text(
                  'HadesCool',
                  style: TextStyle(fontWeight: FontWeight.bold),
                ),
                accountEmail: Text('HadesCool@foxmail.com'),
                currentAccountPicture: CircleAvatar(
                  backgroundImage: NetworkImage(
                      'http://img.funbling.net/Fr5pVA_Dn1pqrGFhMrQBQc9Z6aJz'),
                ),
                decoration: BoxDecoration(
                  color: Colors.yellow[400],
                  image: DecorationImage(
                      image: NetworkImage(
                          'https://resources.ninghao.org/images/space-skull.jpg'),
                      //背景图的填充方式
                      fit: BoxFit.cover,
                      //添加背景的滤镜
                      colorFilter: ColorFilter.mode(
                          Colors.yellow.withOpacity(0.6), BlendMode.srcOver)),
                ),
              ),
              ListTile(
                title: Text('Message', textAlign: TextAlign.right),
                trailing:
                    Icon(Icons.message, color: Colors.black12, size: 22.0),
                onTap: () => Navigator.pop(context),
              ),
              ListTile(
                title: Text('Favourite', textAlign: TextAlign.right),
//                  leading: 左边，trailing：右边
                trailing:
                    Icon(Icons.favorite, color: Colors.black12, size: 22.0),
                onTap: () => Navigator.pop(context),
              ),
              ListTile(
                title: Text('Setting', textAlign: TextAlign.right),
                trailing:
                    Icon(Icons.settings, color: Colors.black12, size: 22.0),
                onTap: () => Navigator.pop(context),
              ),
            ],
          ),
        ),
        bottomNavigationBar: BottomNavigationBarDemo(),
      ),
    );
  }
}
